unsigned long mfn;
evtchn_port_t port;
int rc;
+ struct xenstore_domain_interface *interface;
if (get_strings(in, vec, ARRAY_SIZE(vec)) < ARRAY_SIZE(vec)) {
send_error(conn, EINVAL);
domain = find_domain_by_domid(domid);
if (domain == NULL) {
- /* Hang domain off "in" until we're finished. */
- domain = new_domain(in, domid, port);
- if (!domain) {
+ interface = xc_map_foreign_range(
+ *xc_handle, domid,
+ getpagesize(), PROT_READ|PROT_WRITE, mfn);
+ if (!interface) {
send_error(conn, errno);
return;
}
- domain->interface = xc_map_foreign_range(
- *xc_handle, domid,
- getpagesize(), PROT_READ|PROT_WRITE, mfn);
- if (!domain->interface) {
+ /* Hang domain off "in" until we're finished. */
+ domain = new_domain(in, domid, port);
+ if (!domain) {
+ munmap(interface, getpagesize());
send_error(conn, errno);
return;
}
+ domain->interface = interface;
domain->mfn = mfn;
/* Now domain belongs to its connection. */